﻿using System;

namespace IFD2
{
    public partial class MyOrders : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                lblError.Text = "";
                return;
            }
            else
            {
                if (Session["ACL"].ToString().IndexOf("SA1") < 0)
                {
                    Response.Redirect("unauthorized.aspx");
                }
                //ToLocalTime(),ToUniversalTime()!!Server or Page?
                txtDateFrom.Text = (DateTime.Now.AddDays(-7)).ToShortDateString();
                txtDateTo.Text = (DateTime.Now.AddDays(1)).ToShortDateString();

            }

            //butRefresh_Click(sender, e);
        }

        protected void lbtnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime.Parse(txtDateFrom.Text);
                DateTime.Parse(txtDateTo.Text);
            }
            catch
            {
                lblError.Text = "Invalid date format!";
                txtDateFrom.Text = "";
                txtDateTo.Text = "";
                return;
            }

            if (radMine.Checked)
                hidWho.Value = "M";
            else
                hidWho.Value = "O";

            GridView1.DataBind();
        }
    }
}